/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef OHOS_NWEB_SRC_WEB_EXTENSION_WINDOW_ITEMS_H_
#define OHOS_NWEB_SRC_WEB_EXTENSION_WINDOW_ITEMS_H_

#include <memory>
#include <optional>
#include <string>
#include <vector>

#include "web_extension_tab_items.h"
#include "web_extension_window_items_type.h"

enum WebExtensionWindowId {
  WINDOW_ID_CURRENT = -2,
  WINDOW_ID_NONE = -1,
};

enum class WebExtensionWindowState {
  NORMAL = 0,
  MINIMIZED,
  MAXIMIZED,
  FULLSCREEN,
  LOCKED_FULLSCREEN,
  UNKNOWN_STATE,
};

enum class WebExtensionWindowCreateType {
  NORMAL,
  POPUP,
  UNKNOWN_TYPE
};

struct WebExtensionWindowCreateData {
  static const int32_t NUM_PROPERTIES = 11;
  std::optional<bool> focused;
  std::optional<int32_t> height;
  std::optional<bool> incognito;
  std::optional<int32_t> left;
  std::optional<bool> setSelfAsOpener;
  std::optional<WebExtensionWindowState> state;
  std::optional<std::string> stateStr;
  std::optional<int32_t> tabId;
  std::optional<int32_t> top;
  std::optional<WebExtensionWindowCreateType> type;
  std::optional<std::string> typeStr;
  std::optional<std::vector<std::string>> urls;
  std::optional<int32_t> width;
};
 
struct WebExtensionWindowUpdateInfo {
  static const int32_t NUM_PROPERTIES = 7;
  std::optional<bool> drawAttention;
  std::optional<bool> focused;
  std::optional<int32_t> height;
  std::optional<int32_t> left;
  std::optional<WebExtensionWindowState> state;
  std::optional<std::string> stateStr;
  std::optional<int32_t> top;
  std::optional<int32_t> width;
};

struct WebExtensionWindowQueryOptions {
  static const int32_t NUM_PROPERTIES = 2;
  std::optional<bool> populate;
  std::optional<std::vector<std::string>> windowTypes;
};

struct WebExtensionWindow {
  int32_t nwebId;
  bool alwaysOnTop;
  bool focused;
  std::optional<int32_t> height;
  std::optional<int32_t> id;
  bool incognito;
  std::optional<int32_t> left;
  std::optional<std::string> sessionId;
  std::optional<std::string> state;
  std::vector<NWebExtensionTab> tabs;
  std::optional<int32_t> top;
  std::optional<std::string> type;
  std::optional<int32_t> width;
};

struct WebExtensionWindowQueryOptionsV2 {
  static const int32_t NUM_PROPERTIES = 4;
  std::optional<bool> populate;
  std::optional<std::vector<std::string>> windowTypes;
  std::optional<std::string> contextType;
  std::optional<bool> includeIncognitoInfo;
};

struct WebExtensionWindowCreateDataV2 {
  static const int32_t NUM_PROPERTIES = 16;
  std::optional<bool> focused;
  std::optional<int32_t> height;
  std::optional<bool> incognito;
  std::optional<int32_t> left;
  std::optional<bool> setSelfAsOpener;
  std::optional<WebExtensionWindowState> state;
  std::optional<std::string> stateStr;
  std::optional<int32_t> tabId;
  std::optional<int32_t> top;
  std::optional<WebExtensionWindowCreateType> type;
  std::optional<std::string> typeStr;
  std::optional<std::vector<std::string>> urls;
  std::optional<int32_t> width;
  std::optional<std::string> extensionId;
  std::optional<std::string> contextType;
  std::optional<bool> includeIncognitoInfo;
};

struct WebExtensionWindowUpdateInfoV2 {
  static const int32_t NUM_PROPERTIES = 11;
  std::optional<bool> drawAttention;
  std::optional<bool> focused;
  std::optional<int32_t> height;
  std::optional<int32_t> left;
  std::optional<WebExtensionWindowState> state;
  std::optional<std::string> stateStr;
  std::optional<int32_t> top;
  std::optional<int32_t> width;
  std::optional<std::string> extensionId;
  std::optional<std::string> contextType;
  std::optional<bool> includeIncognitoInfo;
};

struct WebExtensionWindowRemoveInfoV2 {
  static const int32_t NUM_PROPERTIES = 3;
  std::optional<std::string> extensionId;
  std::optional<std::string> contextType;
  std::optional<bool> includeIncognitoInfo;
};

#endif  // OHOS_NWEB_SRC_WEB_EXTENSION_WINDOW_ITEMS_H_
